import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [{
      path: '/',
      name: 'index',
      redirect: '/index'
    },
    {
      path: '/upload',
      name: 'upload',
      component: () => import('../views/Upload.vue')
    }, 
    {
      path: '/index',
      name: 'Home',
      component: () => import('../views/Home.vue'),
      meta: {
        tabbarshow: true,
      }
    },
      {
        path: '/Detail/:rec_id',
        name: 'Detail',
        component: () => import('../views/Detail.vue'),
        props: true,
        meta: {
          tabbarshow: false,
        }
      },
      {
        path: '/menu',
        name: 'Menu',
        component: () => import( /* webpackChunkName: "about" */ '../views/Menu.vue'),
        meta: {
          tabbarshow: true,
        }
      },
      {
        path: '/cooklist/:sub_name/:cid',
        props: true,
        name: 'CookList',
        component: () => import('../views/CookList.vue'),
        meta: {
          tabbarshow: false,
          keepalive: true
        }
      },
      {
        path: '/cookdetail',
        name: 'CookDetail',
        component: () => import('../views/CookDetail.vue'),
        meta: {
          tabbarshow: false,
        }
      },
      {
        path: '/search',
        name: 'Search',
        component: () => import('../views/Search.vue'),
        meta: {
          tabbarshow: false,
        }
      },
      {
        path: '/square',
        name: 'Square',
        component: () => import('../views/Square.vue'),
        meta: {
          tabbarshow: true,
        }
      },
      {
        path: '/myinfo',
        name: 'MyInfo',
        component: () => import('../views/MyInfo.vue'),
        meta: {
          tabbarshow: true,
        },
      },
      {
        path: '/shop/:id',
        name: 'Shop',
        props:true,
        component: () => import('../views/Shop.vue'),
        meta: {
          tabbarshow: false,
        },
      },
      {
        path: '/login',
        name: 'login',
        component: () => import('../views/Login.vue')
      },
      {
        path: '/register',
        name: 'register',
        component: () => import('../views/Register.vue')
      }
    ]

    const router = new VueRouter({
      mode: 'history',
      base: process.env.BASE_URL,
      routes
    })

    export default router